<template>
  <div class="xk-modal">
    <el-dialog title="收货地址" :visible.sync="dialogVisible" width="30%">
      <xk-form v-bind="modalConfig" v-model="modalFormData" />
      <!-- <xk-form :formConfig="formConfig" /> -->
      <template v-slot:footer>
        <div>
          <el-button @click="dialogVisible = false" type="text">取消</el-button>
          <el-button @click="dialogVisible = false" type="primary"
            >确定</el-button
          >
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script>
import xkForm from "../../baseUi/form/xkForm";
export default {
  components: {
    xkForm,
  },
  props: {
    modalConfig: {
      type: Object,
      required: true,
    },
    defaultInfo: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  watch: {
    defaultInfo: {
      handler(newValue) {
        for (let item of this.modalConfig.formItem) {
          this.modalFormData[`${item.field}`] = newValue[`${item.field}`];
        }
      },
    },
  },
  data() {
    return {
      modalFormData: {},
      dialogVisible: false,
    };
  },
};
</script>
<style scoped></style>
